package com.zgz.underwrite.action;

import java.util.List;

import com.zgz.underwrite.dao.SpecialConventionDao;
import com.zgz.underwrite.model.SpecialConvention;

public class SpecialConventionAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5868388223927136402L;

	private SpecialConvention spec;
	private SpecialConventionDao specDao;
	
	public String newSpec(){
		try {
			this.specDao.save(this.spec);
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ERROR;
	}
	
	public String findAllSpec(){
		List<SpecialConvention> list;
		try {
			list = this.specDao.getAll();
			super.request.setAttribute("specs", list);
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ERROR;
	}

	public void setSpecDao(SpecialConventionDao specDao) {
		this.specDao = specDao;
	}

	public SpecialConventionDao getSpecDao() {
		return specDao;
	}

	public void setSpec(SpecialConvention spec) {
		this.spec = spec;
	}

	public SpecialConvention getSpec() {
		return spec;
	}
}
